/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EasyInterface;
import FMMLogic.*;
import java.util.ArrayList;
import java.util.List;
import Domain.Output;
import Domain.State;
import Domain.Cluster;
import be.ac.ulg.montefiore.run.jahmm.Hmm;
import be.ac.ulg.montefiore.run.jahmm.ObservationDiscrete;
/**
 *
 * @author Ryan
 */
public class PredictionTest {
     public static void main(String[] args) {

        /*initialize the logic calculator*/
        int clusternumber = 3;
        List<Output[]> oseq_list = new ArrayList<Output[]>();
        ArrayList<Cluster> cluster_list = new ArrayList<Cluster>();
        List<Hmm<ObservationDiscrete<Output>>> hmmList=
                              new ArrayList<Hmm<ObservationDiscrete<Output>>>();
        Output [] oseq = null;
        State [][] sseq =null;
        Cluster clus = null;


        Hmm<ObservationDiscrete<Output>> hmm = null;
        LFMMTrainer fmm = new LFMMTrainer("data_seq/WP4.seq");
        LFMMPredictor pdc = new LFMMPredictor();
        LFMMCluster lc = new LFMMCluster(3);

        /*train and calculate the HMMs*/
        fmm.train("data_test/result.txt");
        cluster_list = lc.kmeansCalculate(fmm.getHmms());
        hmmList = fmm.getHmms();
        oseq_list = fmm.getOutputs();
        

        /*do prediction*/
        double [][]probArray = new double [hmmList.size()][clusternumber];
        sseq = new State[hmmList.size()][];
        for (int i =0; i < oseq_list.size(); i++) {
            oseq = oseq_list.get(i);
            hmm = hmmList.get(i);
            pdc.initViterbi(oseq, hmm);
            sseq[i] = pdc.stateSequence();

            for (int j=0; j < cluster_list.size(); j++) {
                clus = cluster_list.get(j);
                 Hmm<ObservationDiscrete<Output>> testhmm = clus.getAvgHmm();
                pdc.initFb(oseq, testhmm);
                probArray[i][j] = pdc.Probability();
               
            }
        }
       int test =1;
    }
}
